// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.chat.defaultChats;

import java.nio.ByteBuffer;
import zombie.characters.IsoPlayer;
import zombie.chat.ChatMessage;
import zombie.chat.ChatSettings;
import zombie.chat.ChatTab;
import zombie.chat.ChatUtility;
import zombie.core.Color;
import zombie.network.chat.ChatType;

public class SayChat extends RangeBasedChat {
    public SayChat(ByteBuffer bb, ChatTab tab, IsoPlayer owner) {
        super(bb, ChatType.say, tab, owner);
        if (!this.isCustomSettings()) {
            this.setSettings(getDefaultSettings());
        }
    }

    public SayChat(int id, ChatTab tab) {
        super(id, ChatType.say, tab);
        if (!this.isCustomSettings()) {
            this.setSettings(getDefaultSettings());
        }
    }

    public SayChat() {
        super(ChatType.say);
        this.setSettings(getDefaultSettings());
    }

    public static ChatSettings getDefaultSettings() {
        ChatSettings chatSettings = new ChatSettings();
        chatSettings.setBold(true);
        chatSettings.setFontColor(Color.white);
        chatSettings.setShowAuthor(true);
        chatSettings.setShowChatTitle(true);
        chatSettings.setShowTimestamp(true);
        chatSettings.setUnique(true);
        chatSettings.setAllowColors(true);
        chatSettings.setAllowChatIcons(true);
        chatSettings.setAllowImages(true);
        chatSettings.setAllowFonts(false);
        chatSettings.setAllowBBcode(true);
        chatSettings.setEqualizeLineHeights(true);
        chatSettings.setRange(30.0F);
        chatSettings.setZombieAttractionRange(15.0F);
        return chatSettings;
    }

    public ChatMessage createInfoMessage(String text) {
        ChatMessage chatMessage = this.createBubbleMessage(text);
        chatMessage.setLocal(true);
        chatMessage.setShowInChat(false);
        return chatMessage;
    }

    public ChatMessage createCalloutMessage(String text) {
        ChatMessage chatMessage = this.createBubbleMessage(text);
        chatMessage.setLocal(false);
        chatMessage.setShouldAttractZombies(true);
        return chatMessage;
    }

    @Override
    public String getMessageTextWithPrefix(ChatMessage msg) {
        return this.getMessagePrefix(msg) + " " + ChatUtility.parseStringForChatLog(msg.getTextWithReplacedParentheses());
    }
}
